<?php Pants::partial('includes/header'); ?>

<h2>Search Results</h2>

<?php if (count($tags) || count($pages) || count($articles) || count($comments)): ?>
  <p>
    Your search for <strong><?php echo htmlentities($searchQuery); ?></strong>
    returned the following results:
  </p>
  
  <?php if (count($tags)): ?>
    <h3>Tags</h3>

    <?php $tagCount = 0; ?>
    <?php foreach($tags as $tag): ?>
      <?php $tagCount++; ?>
      <img src="<?php echo $themeUrl; ?>/images/tag.png" alt="" class="icon" />
      <a rel="section"
          href="<?php echo $siteUrl; ?>/tag/<?php echo urlencode($tag->name); ?>">
        <?php echo htmlentities($tag->name); ?></a><?php echo $tagCount < count($tags) ? ',' : ''; ?>
    <?php endforeach; ?>
  <?php endif; ?>
  
  <?php if (count($pages)): ?>
    <h3>Pages</h3>
  
    <ul class="slick">
      <?php foreach($pages as $page): ?>
        <?php Pants::partial('includes/page/'.$mode, array('page' => $page)); ?>
      <?php endforeach; ?>
    </ul>
  <?php endif; ?>

  <?php if (count($articles)): ?>
    <h3>Articles</h3>
    
    <ul class="slick">
      <?php foreach($articles as $article): ?>
        <?php Pants::partial('includes/article/'.$mode, array('article' => $article)); ?>
      <?php endforeach; ?>
    </ul>
  <?php endif; ?>

  <?php if (count($comments)): ?>
    <h3>Comments</h3>
    
    <ul class="slick">
      <?php foreach($comments as $comment): ?>
        <?php Pants::partial('includes/comment/'.$mode, array('comment' => $comment)); ?>
      <?php endforeach; ?>
    </ul>
  <?php endif; ?>
<?php else: ?>
  <p>
    Your search for <strong><?php echo htmlentities($searchQuery); ?></strong>
    did not return any results.
  </p>
<?php endif; ?>

<?php Pants::partial('includes/footer'); ?>